{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ca555eab-6d55-45a4-a859-6a8344539b97",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "要下雨了，快做好准备吧\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from sklearn.naive_bayes import BernoulliNB\n",
    "x=np.array([[0,1,0],[1,1,1],[0,1,1],[0,0,0],[0,1,1],[0,1,0],[1,0,0]])\n",
    "y=np.array([0,1,1,0,1,0,0])\n",
    "model = BernoulliNB()\n",
    "model.fit(x,y)\n",
    "pred=model.predict([[1,0,1]])\n",
    "if pred==0:\n",
    "    print('这是一个好天气')\n",
    "else:\n",
    "    print('要下雨了，快做好准备吧')\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1608c60b-bce7-498f-8bd8-789af02c25b9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
